/**
 * link http://www.expressjs.com.cn/4x/api.html 文档地址
 */

const router = (app) => {
  app.all('*', function (req, res, next) {
    res.header('Access-Control-Allow-Origin', '*');
    res.header('Access-Control-Allow-Headers', 'content-type');
    res.header('Access-Control-Allow-Methods', 'PUT,POST,GET,DELETE,OPTIONS');
    res.header('X-Powered-By', '4.15.2');
    res.header('Content-Type', 'application/json;charset=utf-8');
    next();
  });

    /**
   * 获取体育管理系统的相关信息
   * @method POST
   * ```
   * req.body = {
   *   cardID: String, // 用户的学号
   * };
   * ```
   */
  app.post('/api1', function (req, res) {
    // console.log('<<----------------------getPEInfo-------------------->>');
    console.log(res);
    // const params = req.body;
    // sportsManagementSys({
    //   cardID: params.cardID || '' ,
    // }, (data) => {
    //   console.log(data);
    //   res.json({
    //     success: true,
    //     data,
    //   });
    // });
  });

  app.get('/api2/:id', function (req, res) {
    console.log(req.params);
    res.send('user ' + req.params.id);
  });
};

export default router;
